cc.Class({
    extends: cc.Component,

    properties: {
        score: 0,
    },

    // use this for initialization
    onLoad: function () {

    },
    start: function(){
        var label = this.getComponent(cc.Label);
        label.string = '分数为：'+this.score;
        var _this = this
        //从button那里收到发射的消息，进行分数+1处理
        this.node.on('233', function (event) {
            event.stopPropagation();
            _this.incScore();
            label.string = '分数为：'+_this.score;
        });
        //从button那里收到发射的消息，进行分数-1处理
        this.node.on('244', function (event) {
            event.stopPropagation();
            _this.outScore();
            label.string = '分数为：'+_this.score;
        });

    },
    //分数的加减
    incScore: function () {
        this.score++;
        return this.score;
    },
    getScore: function () {
        return this.score;
    },
    outScore: function () {
        this.score--;
        return this.score;
    }

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
